package com.example.demomcp.config;

import com.example.demomcp.service.ChromeService;
import com.example.demomcp.service.DBToolService;
import com.example.demomcp.service.WeatherService;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.modelcontextprotocol.server.McpServerFeatures;
import io.modelcontextprotocol.spec.McpSchema;
import org.springframework.ai.tool.ToolCallback;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.ToolCallbacks;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;
import java.util.Map;

@Configuration
public class ProviderRegister {
    @Bean
    public ToolCallbackProvider weatherTools(WeatherService weatherService) {
        return MethodToolCallbackProvider.builder()
                .toolObjects(weatherService).build();
    }
    @Bean
    public ToolCallbackProvider dbToolsSse(DBToolService dbToolService) {
        return MethodToolCallbackProvider.builder()
                .toolObjects(dbToolService).build();
    }

    @Bean
    public ToolCallbackProvider chromeToolsSse(ChromeService chromeService) {
        return MethodToolCallbackProvider.builder()
                .toolObjects(chromeService).build();
    }
//    @Bean
//    public List<ToolCallback> weatherToolsSse(WeatherService weatherService) {
//        return List.of(ToolCallbacks.from(weatherService));
//    }
//    @Bean
//    public List<ToolCallback> dbToolsSse(DBToolService dbToolService) {
//        return List.of(ToolCallbacks.from(dbToolService));
//    }

}
